<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiRequest;

class ArticleUpdateRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'article_type_id'     => 'required|numeric',
            'title'               => 'sometimes|required|string',
            'thumb'               => 'sometimes',
//            'banner'              => 'sometimes',
            'carousel_figure'     => 'sometimes',
//            'company_thumb'       => 'sometimes',
            'description'         => 'sometimes|required|string',
            'english_description' => 'sometimes|string',
            'english_content'     => 'sometimes|string',
            'english_title'       => 'sometimes|string',
            'sort'                => 'sometimes|numeric',
            'content'             => 'required|string',
            'keywords'             => 'sometimes|required|string',
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'article_type_id.*'     => ':attribute必须是数字',
            'title.*'               => ':attribute必须是字符串',
            'thumb.*'               => ':attribute必须是大于2048的图片',
//            'banner.*'              => ':attribute必须是大于2048的图片',
            'carousel_figure.*'     => ':attribute必须是大于2048的图片',
//            'company_thumb.*'       => ':attribute必须是大于2048的图片',
            'description.*'         => ':attribute必须是字符串',
            'english_description.*' => ':attribute必须是字符串',
            'english_content.*'     => ':attribute必须是字符串',
            'english_title.*'       => ':attribute必须是字符串',
            'sort.*'                => ':attribute必须是数值',
            'content.*'             => ':attribute必须是字符串',
        ];
    }

    /**
     * @return array
     */
    public function attributes()
    {
        return [
            'article_type_id'     => '文章的类别',
            'title'               => '文章的标题',
            'thumb'               => '案例图',
            'banner'              => '导航图',
            'carousel_figure'     => '轮播图',
            'company_thumb'       => '公司缩略图',
            'description'         => '中文描述',
            'english_description' => '英文描述',
            'english_content'     => '英文内容',
            'english_title'       => '英文标题',
            'sort'                => '排序',
            'content'             => '中文内容',
        ];
    }
}
